import React, {useEffect} from "react";
import { StyleSheet } from "react-native";
import { FAB, Portal, Provider } from 'react-native-paper';
const SettingsScreen = ({ navigation }:{navigation?:any}) => {

    const handleLogin = () => {
        // 处理登录逻辑
        navigation?.navigate('WellComeOne')
    };

    const [state, setState] = React.useState({ open: false });

    const onStateChange = ({ open }:any) => setState({ open });

    const { open } = state;

    return (
        <Provider>
            <Portal>
                <FAB.Group
                    open={open}
                    visible
                    icon={open ? 'allergy' :'alien'}
                    actions={[
                        {
                            icon: 'plus',
                            onPress: () => console.log('Pressed add'),
                            testID: 'plus',
                        },
                        {
                            icon: 'account-circle',
                            label: '登录',
                            onPress: () => console.log('Pressed star'),
                            testID: 'account-circle',
                        },
                        {
                            icon: 'wifi-cancel',
                            label: '清除缓存',
                            onPress: () => console.log('Pressed email'),
                            testID: 'cancel',
                        },
                        {
                            icon: 'airballoon',
                            label: '返回主页',
                            onPress: () => console.log('Pressed notifications'),
                            testID: 'airballoon',
                        },
                    ]}
                    onStateChange={onStateChange}
                    onPress={() => {
                        if (open) {
                            // do something if the speed dial is open
                        }
                    }}
                ></FAB.Group>
            </Portal>
        </Provider>
    );
};

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: "center",
        alignItems: "center",
    },
    input: {
        width: "80%",
        marginVertical: 10,
    },
    btn: {
        width: "80%",
        marginVertical: 20,
    },
});

export  {SettingsScreen};
